package com.stylefeng.guns.rest.vo;

import lombok.Getter;
import lombok.Setter;

@Getter @Setter
public class ResultVO<T> {

    private int status;

    private String msg;

    private T data;

    private String imgPre;

    private ResultVO(int status,T data){
        this.status = status;
        this.data = data;
    }

    private ResultVO(int status,T data,String imgPre){
        this.status = status;
        this.data = data;
        this.imgPre = imgPre;
    }

    private ResultVO(int status, String msg){
        this.status = status;
        this.msg = msg;
    }

    public static <T> ResultVO success(T data){
        return new ResultVO(0,data);
    }

    public static <T> ResultVO success(T data,String imgPre){
        return new ResultVO(0,data,imgPre);
    }


    public static <T> ResultVO success(String msg){
        return new ResultVO(0,msg);
    }


    public static ResultVO serviceFail(String msg){
        return new ResultVO(1,msg);
    }

    public static ResultVO appFail(String msg){
        return new ResultVO(999,msg);
    }
}
